﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using System.Text;

namespace Chaunce.FrameWork.NetCore.BaseDomain
{
    /// <summary>
    /// DB表基础属性
    /// </summary>
    public abstract class BaseDomain<T>
    {
        public BaseDomain()
        {
            CreateTime = DateTime.Now;
        }
        /// <summary>
        /// 主键Id
        /// </summary>
        [DataMember]
        [Key]
        public T Id { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreateTime { get; set; }

        /// <summary>
        /// 更新时间(充当版号RowVersion)
        /// </summary>
        [ConcurrencyCheck]
        public DateTime UpdateTime { get; set; } = DateTime.Now;

        /// <summary>
        /// 实体状态
        /// </summary>
        public DomainStateEnum DomainState { get; set; }
    }
}
